package com.freewater.springboot.demo.ioc.eventlistener;

import org.springframework.context.ApplicationEvent;
import org.springframework.core.ResolvableType;
import org.springframework.core.ResolvableTypeProvider;

import java.io.Serial;

public class EntityCreatedEvent<T> extends ApplicationEvent implements ResolvableTypeProvider {

    @Serial
    private static final long serialVersionUID = 1L;

    public EntityCreatedEvent(T t) {
        super(t);
    }

    @Override
    public ResolvableType getResolvableType() {
        return ResolvableType.forClassWithGenerics(getClass(), ResolvableType.forInstance(getSource()));
    }
}
